<script type="text/javascript">
$(document).ready(function(){
	$("#contact_form_show,#undo_btn").click(function(){
		$("#form_container").animate({
			"height": "toggle"
		})
	})
	$("#contact_form").ajaxForm({
		target: '#form_container',
		beforeSubmit: function(){
			if($('input[name=name]').fieldValue() == ""){
				$('input[name=name]').after("<span class='advice' id='advice_name'>Riempire correttamente</span")
				return false
			}else{
				$('#advice_name').remove()
			}

			if($('input[name=mail]').fieldValue() == ""){
				$('input[name=mail]').after("<span class='advice' id='advice_mail'>Riempire correttamente</span")
				return false
			}else{
				$('#advice_mail').remove()
			}
			var emailPattern = "/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/i";

			if($('textarea[name=msg]').fieldValue() == ""){
				$('textarea[name=msg]').after("<span class='advice' id='advice_msg'>Riempire correttamente</span")
				return false
			}else{
				$('#advice_msg').remove()
			}
		}
	})

})
</script>
<h1>Contacts</h1>
<p>Sandro del Pistoia pu&ograve; essere contattato attraverso questa galleria d'arte</p>

<p class="address">
	<b>Margini Arte Contemporanea</b>
	<br />Via dei Margini, 11
	<br />Massa, 54100, Italy
	<br />+39 0585 42048
	<br /><img src="images/info@margini.it.png"/>
</p>

<p>Oppure puoi contattare direttamente Sandro del Pistoia utilizzando <a href="#contacts@mail" id="contact_form_show">questo modulo:</a></p>
<div id="form_container">
	<form id="contact_form" action="scripts/sendmail.php" method="post">
		<p class="left">Your name:* </p><p class="right"><input type="text" name="name"></p>
		<p class="left">Your mail address:* </p><p class="right"><input type="text" name="mail" /></p>
		<p class="left">Message:* </p><p class="right"><textarea name="msg"></textarea></p>
		<p class="left"></p><p class="right"><input type="submit" /> <input type="reset" /><input type="button" id="undo_btn" value="Annulla" /></p>
	</form>
</div>